// 获取大赢家数量
getWinnerNum = (seats) => {
    let num = 0;
    seats.forEach((item) => {
        if (item.iswiner) num += 1;
    });
    return num;
};
// 判断用户是否在当前游戏内
judgeUserIsInGameSeat = (uid, seats) => {
    let data = null;
    seats.forEach((item) => {
        if (uid == item.userid) data = item;
    });
    return data;
};
// 格式化 数字 为带符号字符串
parseNumber = (number) => {
    if (number >= 0) return `+${number}`;
    else return `${number}`;
};
// 获取数组索引
getArrayIndex = (arr, target) => {
    let i = null;
    arr.forEach((item, index) => {
        if (item.setletcreatetime == target) i = index;
    });
    return i;
};

module.exports = {
    getWinnerNum,
    judgeUserIsInGameSeat,
    parseNumber,
    getArrayIndex,
};